package misc;

public class Main2 extends Thread{
	public static void main(String[] args) {
		System.out.println("Welcome to threading.");
		Main2 t1 = new Main2();
		t1.setName("1st thread");
		t1.start();

		Main2 t2 = new Main2();
		t2.setName("2nd thread");
		t2.start();
		//System.out.println(t2);

		System.out.println("Hope you enjoyed Threading.");
	}

	public void run() {
		for (int i = 0; i < 5; i++) {
			System.out.println("Hello : " + Thread.currentThread().getName()+" "+i);
			try {
				Thread.sleep(500);
			} catch (InterruptedException ex) {
				// some code
			}
		}
	}

}
